﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Web;
using SD.Commons.Helpers;

namespace MockPrjTeam1.DAO
{
    public class LoginDAO
    {
        //public static bool GetUser(string UserName, string Password)
        //{
        //    LoginLinqDataContext db = new LoginLinqDataContext();
        //    IEnumerable<User> users = from p in db.Users
        //                              where p.Account == UserName
        //                              select p;
        //    foreach (User user in users)
        //    {
        //        if (Password == user.Password)
        //        {
        //            return true;
        //        }
        //    }
        //    return false;
        //}
        public bool GetUser(string UserName, string Password)
        {
            var temp = new Collection<SqlParameter>();
            temp.Add(new SqlParameter("p1", UserName));
            temp.Add(new SqlParameter("p2", Password));

            var results = SqlHelper.ExecuteReader("ValidUser", temp);
            if (results.Read())
            {
                return true;
            }
            else
                return false;
        }
    }
}